/**
 * PlayerSelfSingleton.java
 *
 * @author Beatrice Bacelli
 * @author Luca Bedogni
 * @author Silvia Righini
 */
package unibo.lsb.logic;

/**
 * Singleton for {@link PlayerSelf}
 */
public class PlayerSelfSingleton {

	private static PlayerSelfSingleton playerSelfSingleton;
	private static PlayerSelf playerSelf;

	public static PlayerSelf getSelf() {
		return playerSelf;
	}

	private PlayerSelfSingleton() {
	}

	public static PlayerSelfSingleton getInstance() {
		if (playerSelfSingleton == null) {
			playerSelfSingleton = new PlayerSelfSingleton();
		}
		return playerSelfSingleton;
	}

	public static void setPlayerId(PlayerId pi) {
		if (playerSelf == null) {
			playerSelf = new PlayerSelf(pi);
		}
	}

}
